<extend name="Base/base" />
<block name='head'>
    <meta charset="utf-8">
    <link href="/Public/static/dropload/dropload.css" rel="stylesheet" />
    <!--<link href="/Public/Index/css/workflow.css" rel="stylesheet" />--> 
</block>
<block name="content" > 
    <div class="approval_details">
        <ul>
            <notempty name="runs">
                <foreach name="runs" item="run">
                    <li>
                        <a href="{:U('Index/showForm',array('id'=>$run['flow_type']['form_id'],'run_id'=>$run['run_id'],'prcs_id'=>$run['prcs']))}">
                            <span class="round grayRound" style="color:#999">&#xe601;</span><span class="name">{$run.begin_user|getChineseName}</span><span class="time">{$run.create_time}</span>
                            <p class="application">{$run.flow_type.flow_name}</p>
                            <if condition="$run['maxPrcs'] == $run['prcs']">
                            <p class="reason" style='color:#ED8D76'>第{$run.prcs}步：{$run.prcs_name}(已完结)</p>
                            <else/>
                            <p class="reason">第{$run.prcs}步：{$run.prcs_name}</p>
                            </if>
                        </a>
                    </li>
                </foreach>
                <else />
                <li>
                    <a href="">
                        <span class="name">暂无数据</span>
                    </a>
                </li>
            </notempty>
        </ul>
        <input type="hidden" id="url" value="{:U('droploadFinish')}">
    </div>
    <div class="button">
        <a class="am-btn back" data-url="{:U('Index/index')}">返 回</a>
    </div>

    <!--    <div class="transferred_table">
            <table border="1">
                <tr>
                    <th>流水号</th>
                    <th>公文名称/文号</th>
                    <th>发起人</th>
                    <th>当前处理人</th>
                    <th>步骤</th>
                    
                </tr>
                <notempty name="runs">
                    <foreach name="runs" item="run">
                        <tr>
                            <td>{$run.run_id}</td>
                            <td><a href="{:U('Index/showForm',array('id'=>$run['flow_type']['form_id'],'run_id'=>$run['run_id'],'prcs_id'=>$run['flow_prcs']))}">{$run.run_name}<if condition="$run['title'] neq null"> - {$run['title']}</if></a></td>
                            <td>{$run.begin_user|getChineseName}</td>
                            <td>{$run.user|getChineseName}</td>
                            <td><a href="{:U('Index/showForm',array('id'=>$run['flow_type']['form_id'],'run_id'=>$run['run_id'],'prcs_id'=>$run['prcs']))}">第{$run.prcs}步：{$run.prcs_name}</a></td>
                        </tr>
                    </foreach>
                    <else />
                    <tr><td colspan="5" style="text-align: left">暂无数据</td></tr>
                </notempty>
            </table>
            <input type="hidden" id="url" value="{:U('droploadFinish')}">
        </div>-->

</block>
<block name="script">
    <script type="text/javascript" src="/Public/static/dropload/dropload.js" ></script>
    <script type="text/javascript" src="/Public/Index/js/form.js"></script>
    <script type="text/javascript">
        $('.back').on('click', function () {
            location.href = $(this).attr('data-url')
        })

        $(initDelForm());

        $(function () {
            p = 2;
            var dropload = $('.approval_details').dropload({
                scrollArea: window,
                domDown: {
                    domClass: 'dropload-down',
                    domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
                    domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                    domNoData: '<div class="dropload-noData">已无数据</div>'
                },
                loadDownFn: function (me) {
                    var url = $('#url').val() + '?p=' + p;
                    p++;
                    $.ajax({
                        url: url,
                        type: 'get',
                        success: function (res) {
                            console.log(res)
                            if (res.length > 0) {
                                var html = '';
                                for (var i = 0; i < res.length; i++) {
                                    html += '<li>';
                                    html += '<a href="/index.php/Index/Index/showform/id/' + res[i].flow_id + '/run_id/' + res[i].run_id + '/prcs_id/' + res[i].prcs + '">';
                                    html += '<span class="round grayRound" style="color:#999">&#xe601;</span><span class="name">' + res[i].begin_user + '</span><span class="time">' + res[i].create_time + '</span>';
                                    html += '<p class="application">' + res[i].flow_type.flow_name + '</p>';
                                    html += ' <p class="reason">第' + res[i].prcs + '步：' + res[i].prcs_name + '</p>';
                                    html += '</a></li>';

//                                    html += '<tr><td>' + res[i].run_id + '</td>';
//                                    html += '<td><a href="/Index/Index/showform/id/' + res[i].flow_id + '/run_id/' + res[i].run_id + '/prcs_id/' + res[i].prcs + '">' + res[i].run_name + '</a></td>';
//                                    html += '<td>' + res[i].begin_user + '</td>';
//                                    html += '<td>' + res[i].user + '</td>';
//                                    html += '<td><a href="/Index/Index/showform/id/' + res[i].flow_id + '/run_id/' + res[i].run_id + '/prcs_id/' + res[i].prcs + '">第' + res[i].prcs + '步：' + res[i].prcs_name + '</a></td></tr>';
                                }
                                $('.approval_details ul li:last').after(html);
                            } else {
                                me.noData();
                            }
                            me.resetload();
                        }
                    })
                }
            });
        })
    </script>
</block>

